﻿/**
 * @file   FITKAbaqusAdaptorConstraint.h
 * @brief Abaqus Constraint 适配器 用于读取INP过程中的Part里的约束解析
 * @author liuzhonghua (liuzhonghuaszch@163.com)
 * @date 2024-04-17
 */
#ifndef __FITKABAQUSADAPTORCONSTRAINT__H__
#define __FITKABAQUSADAPTORCONSTRAINT__H__

#include "FITKAbaqusAbstractAdaptor.h"
#include "FITK_Kernel/FITKAdaptor/FITKIOAdaptorFactory.h"
#include "FITKAbaqusGetInterfaceTool.h"

 //前置声明
ForwardDeclarNS(AbaqusData, FITKDataCase)
ForwardDeclarNS(Interface, FITKAbaAbstractConstraint)
ForwardDeclarNS(Interface, FITKAbaConstraintCoupling)
ForwardDeclarNS(Interface, FITKAbaConstraintTie)
ForwardDeclarNS(Interface, FITKAbaConstraintRigidBody)
ForwardDeclarNS(Interface, FITKAbaTransformManager)
ForwardDeclarNS(Interface, FITKModelSet)

namespace IO
{
    /**
     * @brief Abaqus Constraint 读写适配器
     * @author liuzhonghua (liuzhonghuaszch@163.com)
     * @date 2024-04-17
     */
    class FITKAbaqusIOINPAPI FITKAbaqusAdaptorConstraint : public FITKAbaqusAbstractAdaptor
    {
    public:
        explicit FITKAbaqusAdaptorConstraint() = default;
        ~FITKAbaqusAdaptorConstraint() = default;

        /**
         * @brief 获取适配器数据类型名
         * @return 适配器数据类型名
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-04-17
         */
        QString getAdaptorClass() override;

        /**
         * @brief 设置算例数据对象
         * @param caseData
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-04-17
         */
        void setCaseData(AbaqusData::FITKDataCase* caseData);

        /**
         * @brief 适配器读取 CFORCE
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-04-17
         */
        bool adaptR() override;

        /**
         * @brief 适配器写出
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-04-17
         */
        bool adaptW() override;

    private:
        /**
         * @brief 读取耦合Coupling约束
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-04-17
         */
        bool constraintCouplingR();
        /**
         * @brief 读取绑定Tie约束
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-04-17
         */
        bool constraintTieR();
        /**
         * @brief 
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-04-17
         */
        bool constraintRigidBodyR();
        /**
         * @brief 写出耦合Coupling约束
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-04-17
         */
        bool constraintCouplingW();
        /**
         * @brief 写出绑定Tie约束
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-04-17
         */
        bool constraintTieW();
        /**
         * @brief
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-04-17
         */
        bool constraintRigidBodyW();
        /**
         * @brief 写出表面
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-07-18
         */
        bool writeSurface();
        /**
         * @brief 写出表面数据通过set
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-07-18
         */
        bool writeSurfaceBySetData(Interface::FITKModelSet* set);

    private:

        /**
         * @brief 算例数据
         * @author fulipeng (fulipengqd@yeah.net)
         * @date 2024-03-26
         */
        AbaqusData::FITKDataCase* _caseData{};
        /**
         * @brief 获取接口 工具类
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-04-25
         */
        FITKAbaqusGetInterfaceTool _tool;
        /**
         * @brief 局部坐标系管理器
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-07
         */
        Interface::FITKAbaTransformManager* _transformManager{};
        /**
         * @brief 表面名称
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-07-18
         */
        QStringList _surfaceName;
    };
    Register2FITKIOAdaptorFactory(INP, Interface::FITKAbaAbstractConstraint, FITKAbaqusAdaptorConstraint, 1)
    Register2FITKIOAdaptorFactory(INP, Interface::FITKAbaConstraintCoupling, FITKAbaqusAdaptorConstraint, 2)
    Register2FITKIOAdaptorFactory(INP, Interface::FITKAbaConstraintTie, FITKAbaqusAdaptorConstraint, 3)
    Register2FITKIOAdaptorFactory(INP, Interface::FITKAbaConstraintRigidBody, FITKAbaqusAdaptorConstraint, 4)
}

#endif